package tests;

import junit.framework.TestCase;

import org.junit.After;
import org.junit.Before;

/**
 * Title: GamesTest class for CSIS 343 Final Project 
 * Description: CS 343 Final Project - GamesTest This class will test the Games class 
 * 
 * @author Erik Olson
 * @email erik.olson-5@my.uwrf.edu
 * @author Mike Harmon
 * @email michael.harmon@my.uwrf.edu
 * @author Jack Friermuth
 * @email jack.friermuth@my.uwrf.edu
 * @author Luke Vang
 * @email luke.vang@my.uwrf.edu
 * @author Casey Golla
 * @email casey.golla@my.uwrf.edu
 * @date December 4th 2012
 */
public class GamesTest extends TestCase {
	private static com.project.savelog.Games games_default;
	private static com.project.savelog.Games games_alternate;

	@Before
	public void setUp() throws Exception {
		//setting up 2 dummy objects
		games_default = new com.project.savelog.Games();
		games_alternate =  new com.project.savelog.Games( "MegaMan", 1, 1, "/home/mike/Pictures", 1 );
	}

	@After
	public void tearDown() throws Exception {
		//clearing objects out
		games_default = null;
		games_alternate = null;
	}
	
	/**
	 * Tests that the default constructor will set the correct defaults
	 * @Test
	 */
	public final void testDefaultConstructor() {
		assertEquals( games_default.getGame_id(), 0, 0 );
		assertEquals( games_default.getSys_id() , 0, 0 );
		assertEquals( games_default.getGame_title() , "");
		assertEquals( games_default.getGame_cover(), "" );
		assertEquals( games_default.getDev_id(), 0, 0 );
	}
	
	/**
	 * Tests that the alternate constructor will set the provided values
	 * @Test
	 */
	public final void testAlternateConstructor() {
		assertEquals( games_alternate.getGame_id(), 1, 0 );
		assertEquals( games_alternate.getSys_id() , 1, 0 );
		assertEquals( games_alternate.getGame_title() , "MegaMan");
		assertEquals( games_alternate.getGame_cover(), "/home/mike/Pictures" );
		assertEquals( games_alternate.getDev_id(), 1, 0 );
	}

	/**
	 * Tests that getSys_id will return the correct system id
	 * @Test
	 */
	public final void testGetSys_id() {
		assertEquals( games_alternate.getSys_id() , 1, 0 );
	}
	
	/**
	 * Tests that setSys_id will correctly set the system id
	 * @Test
	 */
	public final void testSetSys_id() {
		games_alternate.setSys_id( 2 );
		assertEquals( games_alternate.getSys_id() , 2, 0 );
	}
	
	/**
	 * Tests that getGame_id will return the correct game id
	 * @Test
	 */
	public final void testGetGame_id() {
		assertEquals( games_alternate.getGame_id(), 1, 0 );
	}
	
	/**
	 * Tests that getGame_id will correctly set the game id
	 * @Test
	 */
	public final void testSetGame_id() {
		games_alternate.setGame_id( 2 );
		assertEquals( games_alternate.getGame_id(), 2, 0 );
	}
	
	/**
	 * Tests that getGame_title will get the correct game title
	 * @Test
	 */
	public final void testGetGame_title() {
		assertEquals( games_alternate.getGame_title() , "MegaMan");
	}
	
	/**
	 * Tests that setGame_title will correctly set the game title
	 * @Test
	 */
	public final void testSetGame_title() {
		games_alternate.setGame_title( "Zelda" );
		assertEquals( games_alternate.getGame_title() , "Zelda");
	}
	
	/**
	 * Tests that getGame_cover will get the correct path to the game cover
	 * @Test
	 */
	public final void testGetGame_cover() {
		assertEquals( games_alternate.getGame_cover(), "/home/mike/Pictures" );
	}
	
	/**
	 * Tests that setGame_cover will correcly set the game cover path
	 * @Test
	 */
	public final void testSetGame_cover() {
		games_alternate.setGame_cover( "/home/mike/Documents" ); 
		assertEquals( games_alternate.getGame_cover(), "/home/mike/Documents" );
	}
	
	/**
	 * Tests that getDev_id will get the correct device id
	 * @Test
	 */
	public final void testGetDev_id() {
		assertEquals( games_alternate.getDev_id(), 1, 0 );
	}
	
	/**
	 * Tests that setDev_id will correctly set the device id
	 * @Test
	 */
	public final void testSetDev_id() {
		games_alternate.setDev_id( 2 );
		assertEquals( games_alternate.getDev_id(), 2, 0 );
	}

}
